package com.franzliszt.OrderOnline.util;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class ToastFormat {
    private Context context;
    private TextView tipsText;
    private Toast toast = null;
    public ToastFormat(Context context){
        this.context = context;
    }
    public void InitToast(int layout,int id,int gravity){
        if (toast == null) {
            toast = new Toast(context);
            View view = LayoutInflater.from(context).inflate(layout, null, false);
            tipsText = view.findViewById(id);
            toast.setView(view);
            toast.setGravity(gravity, 0, 0);
        }
    }
    public void setText(String tips){
        tipsText.setText(tips);
    }
    public void show(){
        toast.show();
    }
}
